<?php

$path = dirname(__FILE__);
require($path.'/lib/crt.php');
require_once($path.'/lib/block.php');

//try {

$crt = new CRT();
$crt->init();

$db = DBs::getGISDB();
$sql = "SELECT DISTINCT name FROM ".PENDING_TBL;
$nhs = $db->GetCol($sql);



foreach($nhs as $n) {
}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <title>HQ CRT</title>
        <?php
        $dir = opendir(PLUGIN_PATH.'/css');
        while(($file= readdir($dir))!==false) {
            echo '<link rel="stylesheet" href="/css/'.$file.'" type="text/css" media="all">';
        }

        ?>

    </head>

    <body>

	<h2>Pending Changes</h2>

	<div>
	<table id='pendingChanges'>
	<thead>
	<tr><th>Neighborhood</th><th>Pending Count</th></tr>
	</thead>
	<tbody>
	<?php 
	foreach($nhs as $n) {
		$sql = "SELECT count(*) FROM ".PENDING_TBL." WHERE name=".$db->qstr($n);
		$ct = $db->GetOne($sql);
	}
	echo "<tr><td><strong>$n</strong</td><td>$ct</td></tr>";
	?>
	</tbody>
	</table>
	</div>
   </body>

</html>
